$.fn.longPress = function(fn) {
    var timeout = undefined;
    var $this = this;
    for (var i = 0; i < $this.length; i++) {
        $this[i].addEventListener('touchstart',
                                  function(event) {
                                  timeout = setTimeout( fn, 500,event);
                                  },
                                  false);

        $this[i].addEventListener('touchend',
                                  function(event) {
                                  clearTimeout(timeout);
                                  timeout = 0;
                                  
                                  },
                                  false);
        $this[i].addEventListener('touchmove',
                                  function(event) {
                                  clearTimeout(timeout);
                                  timeout = 0;
                                  },
                                  false);
    }
}

$(document).longPress(function(event) {
                      
                      try {
//                      var x = event.screenX;
//                      var y = event.screenY;
                      
                      
//                      $("#inpudd").val("x"+event.target);
                    
                      //$("#inpudd").val("x"+x+"y"+y);
                      
                      var obj = event.target;
                      
                      if (obj) {
                      
                      if (obj.tagName == 'IMG') {
                      if (obj.src) {
                      ahAppBridge.base.longPress({
                                                  type: "1",
                                                  src: obj.src
                                                  });
                      }
                      } else if (obj.tagName == 'A') {
                      if (obj.href && obj.target == '_blank') {
                      ahAppBridge.base.longPress({
                                                  type: "2",
                                                  src: obj.href
                                                  });
                      }
                      }
                      } else {
                        $("#inpud1d").val("x"+obj);
                      }
                      } catch(err) {　　　
                      }
                      });
